package com.dlkj.myfirstwebapp.hello;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class SayHelloController {
    @RequestMapping("hello")
    @ResponseBody
    public String sayHello() {
        return "Hello World!";
    }

    @RequestMapping("hello-html")
    @ResponseBody
    public String sayHelloHtml() {
        StringBuffer sb = new StringBuffer();
        sb.append("<html>").append("<head>").append("<title> My First HTML Page</title>");
        sb.append("</head>").append("<body>").append("My first HTML page with body");
        sb.append("</body>").append("</html>");

        return sb.toString();
    }

    @RequestMapping("hello-jsp")
    public String sayHelloJsp() {
        return "sayHello";
    }
}
